package d03_Callable;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Test {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable c1=new MyCallable();

        FutureTask<Integer> ft1=new FutureTask<>(c1);

        Thread t1=new Thread(ft1);
        t1.start();

        int sum =1;
        for (int i = 4; i < 100; i+=2) {
            sum+=i;
            System.out.println("主线程：累加奇数。。。。。"+i);
        }
        System.out.println("主线程：累加奇数结束，结果为："+sum);
        Integer result1 = ft1.get();
        System.out.println("线程1：累加偶数结束，结果为："+result1);
    }
}
